﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QD.Snapshot.Core.BLL
{
    public class PromotionReport
    {
        /// <summary>
        /// 将新规则生成的HTML路径，更新到快照表中
        /// </summary>
        /// <param name="model"></param>
        public static int  InserOrUpdate(Model.Snap model)
        {
            int id = DAL.PromotionReport.GetId(model);
            if (id < 0) return -1;

            //更新平台ID
            if (id > 0)
               return DAL.PromotionReport.UpdateHtmlUrl(model, id);
            else
               return DAL.PromotionReport.Add(model);
        }

        /// <summary>
        /// 检测是否存在
        /// </summary>
        /// <param name="model"></param>
        public static int IsExsits(Model.Snap model)
        {
            return DAL.PromotionReport.GetId(model);
        }
    }
}
